package com.bjpowernode.mvc.model.response;


import com.bjpowernode.common.enums.Code;
import lombok.Data;

@Data
public class Response {

    private int code;

    private String msg;

    private Object result;

    public static Response ok(Object data) {
        Response response=new Response();
        response.setCode(Code.SUCC.getCode());
        response.setMsg(Code.SUCC.getMsg());
        response.setResult(data);
        return response;
    }   public static Response ok() {
        Response response=new Response();
        response.setCode(Code.SUCC.getCode());
        response.setMsg(Code.SUCC.getMsg());
        response.setResult("");
        return response;
    }

    public static Response FAIL() {
        Response response=new Response();
        response.setCode(Code.FAIL.getCode());
        response.setMsg(Code.FAIL.getMsg());
        response.setResult("");
        return response;
    }

    public static Response FAIL(Code codeEnum) {
        Response response = new Response();
        response.setCode(codeEnum.getCode());
        response.setMsg(codeEnum.getMsg());
        response.setResult("");
        return response;
    }
    public static Response BUILD(Code codeEnum) {
        Response response = new Response();
        response.setCode(codeEnum.getCode());
        response.setMsg(codeEnum.getMsg());
        response.setResult("");
        return response;
    }

}
